package com.usian.wemedia.conreoller;

import com.usian.apis.wemedia.MaterialManageControllerApi;
import com.usian.common.constants.wemedia.WemediaContans;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.media.dtos.WmMaterialDto;
import com.usian.wemedia.service.WmMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/MaterialManage")
public class MaterialManageController implements MaterialManageControllerApi {
    @Autowired
    WmMaterialService service;

    /**
     * 袁浩 2022-6-25
     * 查找素材
     * @param dto
     * @return
     */
    @PostMapping("/list")
    @Override
    public ResponseResult findlist(@RequestBody WmMaterialDto dto) {
        return service.findlist(dto);
    }

    /**
     * 袁浩
     * @param id
     * @return
     */
    @GetMapping("/del/{id}")
    @Override
    public ResponseResult delPicture(@PathVariable("id") Integer id) {
        return service.del(id);
    }

    @GetMapping("/sc/{id}")
    @Override
    public ResponseResult cancleCollectionMaterial(@PathVariable("id")Integer id) {
        return service.updateCollection(id, WemediaContans.sc);
    }

    @GetMapping("/qx/{id}")
    @Override
    public ResponseResult collectionMaterial(@PathVariable("id") Integer id) {
        return service.updateCollection(id,WemediaContans.qxsc);
    }
}
